package o;

import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class dph {
    private static dph ॱ;
    private Map<String, String> ˋ = new HashMap();
    private Map<String, SessionDownloadTask> ˎ = new HashMap();

    private dph() {
    }

    public static synchronized dph ˋ() {
        dph o_dph;
        synchronized (dph.class) {
            if (ॱ == null) {
                ॱ = new dph();
            }
            o_dph = ॱ;
        }
        return o_dph;
    }

    @NonNull
    public String ˊ(String str) {
        String uuid = UUID.randomUUID().toString();
        this.ˋ.put(uuid, str);
        return uuid;
    }

    @NonNull
    public String ˊ(SessionDownloadTask sessionDownloadTask) {
        String uuid = UUID.randomUUID().toString();
        this.ˎ.put(uuid, sessionDownloadTask);
        return uuid;
    }

    public SessionDownloadTask ॱ(String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        SessionDownloadTask sessionDownloadTask = (SessionDownloadTask) this.ˎ.get(str);
        if (sessionDownloadTask == null) {
            return sessionDownloadTask;
        }
        this.ˎ.remove(str);
        return sessionDownloadTask;
    }

    public boolean ॱ(String str, String str2) {
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            return false;
        }
        if (!str2.equals((String) this.ˋ.get(str))) {
            return false;
        }
        this.ˋ.remove(str);
        return true;
    }
}
